package com.aku.service.impl;

import com.aku.dao.OrderMapper;
import com.aku.entity.Order;
import com.aku.service.OrderService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class OrderServiceImpl implements OrderService {

    @Resource
    private OrderMapper orderMapper;

    @Override
    public List<Order> findAllOrder() {
        List<Order> orders = orderMapper.selectAllOrder();
        return orders;
    }

    @Override
    public Order findOrderById(Integer id) {
        Order order = orderMapper.selectOrderById(id);
        return order;
    }

    @Override
    public boolean addOrder(Order order) {
        int num = orderMapper.insertOrder(order);
        return num > 0;
    }

    @Override
    public boolean updateOrder(Order order) {
        int num = orderMapper.updateOrder(order);
        return num > 0;
    }

    @Override
    public boolean removeOrderById(Integer id) {
        int num = orderMapper.deleteOrderById(id);
        return num > 0;
    }
}
